﻿using System.Configuration;

namespace CssAndJsCombiner.Configuration
{
    public class ClientResourcesSection : ConfigurationSection
    {
        [ConfigurationProperty("version", IsRequired = false, DefaultValue = "")]
        public string Version
        {
            get { return (string)this["version"]; }
            set { this["version"] = value; }
        }

        [
        ConfigurationProperty("stylesheets", IsDefaultCollection = false),
        ConfigurationCollection(typeof(ClientResourceGroupCollection), AddItemName = "group")
        ]
        public ClientResourceGroupCollection Stylesheets
        {
            get { return (ClientResourceGroupCollection)this["stylesheets"]; }
        }

        [
        ConfigurationProperty("javascripts", IsDefaultCollection = false),
        ConfigurationCollection(typeof(ClientResourceGroupCollection), AddItemName = "group")
        ]
        public ClientResourceGroupCollection Javascripts
        {
            get { return (ClientResourceGroupCollection)this["javascripts"]; }
        }

        public static ClientResourcesSection GetSection()
        {
            return ConfigurationManager.GetSection("CssAndJsCombiner") as ClientResourcesSection;
        }
    }
}
